package com.fieldchain.ex.fa100.utils.chart.utils.data;

import com.fieldchain.ex.fa100.utils.chart.dataset.MyBarDataSet;
import com.fieldchain.ex.fa100.utils.chart.dataset.MyBarEntry;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarEntry;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by biyunlong
 * Email: 1225198434@qq.com
 * Data:  2018/10/13
 */
public class DataParseVolum {
    public MyBarDataSet getBarData(List<List<String>> list) {
        BarData barData = null;
        List<MyBarEntry> entries = new ArrayList<>();
        List<BarEntry> entries2 = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            List<String> data = list.get(i);
            MyBarEntry entry = new MyBarEntry(i, Float.parseFloat(data.get(4)));
            entry.setClose(Float.parseFloat(data.get(4)));
            entry.setOpen(Float.parseFloat(data.get(2)));
            entries.add(entry);
            entries2.add(entry);
        }

        MyBarDataSet set = new MyBarDataSet(entries, entries2, "");
        return set;
    }
}
